<script setup lang="ts">
import { login } from '@/api/user'
import { ref } from 'vue'
import { useRouter } from 'vue-router'

// defineProps<{ msg: string }>()

const count = ref(0)
const username = ref('')
const password = ref('')
// ruoter
const router = useRouter()

const handleLogin = async () => {
  const res = await login(username.value, password.value)
  console.log(res)
}

const onLink = () => {
  router.push({ path: 'volar', query: { id: 1 } })
}
</script>

<template>
  <!-- <h1>{{ msg }}</h1> -->
  <van-button type="primary" @click="onLink">主要按钮</van-button>
    <van-button loading type="primary" loading-type="spinner" />
    <van-button loading type="success" loading-text="加载中..." />
  <div class="card">
    <button @click="handleLogin">login</button>
    <button type="button" @click="count++">count is {{ count }}</button>
    <p>
      Edit
    </p>
  </div>
</template>

<style scoped>
.read-the-docs {
  width: 300px;
  text-align: center;
}
</style>
